<template>
  <div>
    <el-generate-form ref="generateFormRef" v-model="formData" :data="widgetForm" >
      </el-generate-form>
    <el-button type="primary" @click="handleSubmit">提交</el-button>
    <el-button type="primary" @click="getSingleTxtConfig">获取单行文本配置</el-button>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import widgetForm from './widgetForm'

const generateFormRef = ref()
const formData = ref()

const handleSubmit = () => {
  generateFormRef.value
    .getData()
    .then((data) => {
      console.log(data, '表单数据')
    })
    .catch((err) => {
      console.log(err)
    })
}

function getSingleTxtConfig() {
  const config = generateFormRef.value.getConfig('input_796609413bc34c1298f25dc7e0182c31')
  console.log(config)
  // config.label = '姓名'
  config.options.disabled = true
}
</script>
